import 'package:shared_preferences/shared_preferences.dart';

class Constant {
  //是否使用mock数据
  static String USE_NET_DATA  = 'USE_NET_DATA';
  //本地图片路径
  static const String ASSETS_IMG = 'assets/images/';
  //默认图片
  static const String DEFAULT_IMG = '';
  //当前登录人用户名KEY
  static const String _USER_NAME = "USER_NAME";
  //当前登录人所属单位
  static const String _USER_ORG = "USER_ORG";
  static const String _USER_ICON = "USER_ICON";
  //查询当前登录用户名
  static Future<Map<String,String>> getLocalUser() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String userName = prefs.getString(Constant._USER_NAME)??'未登录';
    String userOrg = prefs.getString(Constant._USER_ORG)??'组织机构';
    String userIcon  = prefs.getString(Constant._USER_ICON)??'';
    var localUser = {
      'userName':userName,
      'userOrg':userOrg,
      'userIcon': userIcon
    };
    return localUser;
  }
}